package com.fitness.front.controller;

import com.fitness.front.modal.course.vo.CourseCategoryVO;
import com.fitness.front.modal.news.vo.NewsVO;
import com.fitness.front.modal.response.ServerResponseEntity;
import com.fitness.front.service.ICourseCategoryService;
import com.fitness.front.service.INewsService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/front/index")
public class IndexController {

    private final ICourseCategoryService courseCategoryService;
    private final INewsService newsService;
    /**
     * 获取健身分类
     */
    @GetMapping("/category")
    public ServerResponseEntity<List<CourseCategoryVO>> indexCategory() {
        List<CourseCategoryVO> result = courseCategoryService.getIndexCategory();
        return ServerResponseEntity.success(result);
    }

    /**
     * 获取首页新闻
     */
    @GetMapping("/news")
    public ServerResponseEntity<List<NewsVO>> indexNews() {
        List<NewsVO> result = newsService.getIndexNews();
        return ServerResponseEntity.success(result);
    }
}
